package com.itheima.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.entity.PageResult;
import com.itheima.entity.QueryPageBean;
import com.itheima.entity.Result;
import com.itheima.pojo.Order;
import com.itheima.pojo.Setmeal;
import com.itheima.service.OrderSettingListService;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/orderSettingList")
public class OrderSettingListController {
    @Reference
    private OrderSettingListService osls;

    /*查*/
    @RequestMapping("/findPage.do")
    public PageResult findPage(@RequestBody Map map){
        return osls.findPage(map);
    }

    @RequestMapping("/findAllSetMeal.do")
    public Result findAllSetMeal(){
        return osls.findAllSetMeal();
    }

    @RequestMapping("/findSetmealById.do")
    public Result findSetmealById(@Param("setmealId") Integer setmealId){
        return osls.findSetmealById(setmealId);
    }

    /*增*/
    @RequestMapping("/add.do")
    public Result add(@Param("setmealId") Integer setmealId,@RequestBody Map map){
        map.put("setmealId",setmealId);
        return osls.add(map);
    }

    /*删*/
    @RequestMapping("/delete.do")
    public Result delete(@Param("id") Integer id){
        return osls.delete(id);
    }

    /*改*/
    @RequestMapping("/edit.do")
    public Result edit(@Param("setmealId") Integer setmealId,@RequestBody Map map){
        map.put("setmealId",setmealId);
        return osls.edit(map);
    }

    @RequestMapping("/editOrderStatus.do")
    public Result editOrderStatus(@RequestBody Order order){
        return osls.editOrderStatus(order);
    }
}
